package bishi.day39_6_29;

import java.util.*;

/**
 * 字符串计数
 * @author 是阿秋啊
 * @date 2022/06/30 14:59
 **/
public class demo1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            StringBuffer s1 = new StringBuffer(sc.next());
            StringBuffer s2 = new StringBuffer(sc.next());
            int len1 = sc.nextInt();
            int len2 = sc.nextInt();
            for (int i = s1.length(); i < len2; i++) {
                s1.append('a');
            }
            for (int i = s2.length(); i < len2; i++) {
                s2.append('z'+1);
            }
            int[] arr = new int[len2];
            for (int i = 0; i < len2; i++) {
                arr[i]=s2.charAt(i)-s1.charAt(i);
            }
            long ret = 0;
            for (int i = len1; i <= len2; i++) {
                for (int j = 0; j < i; j++) {
                    ret+=arr[j]*Math.pow(26,i - j - 1);
                }
            }
            System.out.println((ret - 1)%1000007);
        }
    }
}